feat: web dashboard + Chrome extension for runtime account management#5
feat: web dashboard + Chrome extension for runtime account management#5danscMax wants to merge 6 commits into
Conversation
Add a localhost-only web dashboard and a Chrome extension to manage the DeepSeek account pool at runtime, layered on top of the existing file-based pool (no duplicate pool): - routes: GET /dashboard, GET /api/accounts, POST /api/accounts/import (cURL/HAR), POST /api/accounts/:id/check, DELETE /api/accounts/:id, GET /api/auth-status — localhost-only and CSRF-guarded - runtime add/delete writes/removes managed files in data/accounts/ then reloads the pool; secrets written 0600 and gitignored - live account check via GET /api/v0/users/current (no PoW), 15s timeout - scripts/auth_from_curl.js + auth_from_har.js import helpers - lib/parseAuth.js parses cURL/HAR auth captures
- dashboard: model picker, inline delete, copy, retry, auto-grow, and a per-account label with inline edit - chrome extension: icons, server-status indicator, dashboard button, label - parseAuth: handle Chrome "Copy as cURL (bash)" ANSI-C headers - server: GET /api/accounts exposes label; POST /api/accounts/:id/label sets it (localhost + CSRF guarded, persisted to the managed account file)
|
Привет! Этот PR добавляет веб-дашборд для управления аккаунтами в рантайме и заметно дорабатывает уже существующее Chrome-расширение (15 файлов, +1323/−203):
Понимаю, что PR крупный — рад разбить его на части или сначала обсудить в issue. Ветка пересобрана на актуальный |
… guard
The popup posts to /api/accounts/import from a chrome-extension:// (or
moz-extension://) origin, which isCrossOrigin treated as cross-site and 403'd
('Cross-origin request rejected') — breaking the one-click account import this
PR adds. Web pages cannot forge an extension Origin and the extension declares
an explicit host permission for this server, so these are trusted. Malicious
http(s) origins are still rejected.
|
Pushed a follow-up fix to this branch: the account-import popup posts from a |
loadHealth read ac.online/ac.total, but /health.accounts is an array of
{id,ready,...}. Derive online=ready count and total=length from the array.
|
Обновил ветку до актуального Подскажите, пожалуйста, есть ли интерес влить дашборд + расширение? Готов поправить что угодно по замечаниям или, если удобнее, разбить на более мелкие PR. Спасибо! |
ForgetMeAI
left a comment
There was a problem hiding this comment.
The dashboard/account-management direction is useful, but I cannot merge this branch yet because the credential-bearing routes still have security blockers:
isCrossOrigin()comparesOrigin.hostto the requestHostheader. Under DNS rebinding both can be the attacker's hostname whileremoteAddressis loopback, so/api/accountsand mutating routes can become reachable from an attacker-controlled page.- Every
chrome-extension://,moz-extension://, andsafari-web-extension://origin is trusted. That grants any installed extension access rather than only this extension. Use explicit extension IDs and/or a server-generated capability/CSRF token. - Imported JSON/cURL/HAR can supply an arbitrary
wasmUrl;solvePOW()later fetches and instantiates it. Restrict this to the known DeepSeek HTTPS asset host/path (including redirects), or ignore imported WASM URLs and use a bundled/pinned asset. DELETEreturns{ok:true}for env-provided accounts even though no file is removed, and sequentialaccount_NIDs change after pool reloads. Use stable IDs and report non-managed accounts as non-deletable.
Please rebase onto current main first; #26 also changed auth, CORS, sessions, retry logic, and the tool parser substantially. I recommend splitting this into: (a) pure cURL/HAR parser + tests, (b) hardened account API with route-level security tests, and (c) dashboard/extension UI. I will gladly review those smaller pieces.
Summary
Adds a localhost-only web dashboard and a Chrome extension for managing the DeepSeek account pool at runtime, built on top of the existing file-based pool (reuses
accounts[]/loadDeepSeekConfig— no second pool). Rebased onto currentmain, so it includes and builds on the recent account-pooling work.What's included
/dashboard): view accounts + statuses, import, check, delete.chrome-extension/): one-click capture of DeepSeek auth → import.GET /api/accounts,POST /api/accounts/import(cURL/HAR),POST /api/accounts/:id/check,DELETE /api/accounts/:id,GET /api/auth-status.scripts/auth_from_curl.js,scripts/auth_from_har.js,lib/parseAuth.js.How it integrates with the pool
Runtime-added accounts are stored as individual JSON files under a managed
data/accounts/dir;discoverAuthPaths()also scans that dir, so they load alongsideDEEPSEEK_AUTH_DIR/deepseek-auth.json. Add/delete write/remove a file and callloadDeepSeekConfig()to reload. No separate account store.Security
/api/accounts*routes are localhost-only and CSRF-guarded.0600;data/accounts/*.jsonis gitignored.Notes / limitations
/api/accounts/:id/checkdoes a realGET /api/v0/users/currentrequest (no PoW, 15s timeout)./checkround-trip. Flows needing a valid live account (successful import + OK check + email) were validated by code review only.Supersedes #2 (which mixed this with a parallel pool implementation; this is rebased clean on top of the current pool).